#!/bin/sh
echo $0 $*

GAMEDIR=${PWD}
echo ==========GAMEDIR is $GAMEDIR
controlfolder="../PortMaster"

source $controlfolder/control.txt
#source $controlfolder/tasksetter

get_controls

gamedir="$GAMEDIR"


$ESUDO chmod 666 /dev/tty1
$ESUDO chmod 666 /dev/uinput


export LD_LIBRARY_PATH="$gamedir/libs:$LD_LIBRARY_PATH"
cd "$gamedir"
$GPTOKEYB "sdlpal" -c "$gamedir/sdlpal.gptk" &
./sdlpal 2>&1 | tee $gamedir/log.txt
$ESUDO kill -9 $(pidof gptokeyb)
unset LD_LIBRARY_PATH